home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CD ROM Paradise Collection 4
/
CD ROM Paradise Collection 4 1995 Nov.iso
/
misc
/
prnf246.zip
/
COUNTPGS.DOC
< prev
next >
Wrap
Text File
|
1993-12-29
|
11KB
|
202 lines
________COUNTPGS Ver. 3.53
Purpose: Examines ASCII text files. Before you print, find out how many
pages, how wide the lines and margins (if any), whether there are
any ragged ends, bare carriage returns, tabs, high-bit charac-
ters,^Z (end of file) characters in the wrong place, or oversize
pages.
Format: COUNTPGS [[d:][path]filename.ext ...] [/Option[/Option]...]
__ ____ ____________ d: is the drive letter, path is the DOS path, and filename.ext may
contain DOS's usual wildcards (* and ?). Omit filenames &
options, and they'll be asked for. These are your options:
_ /Lnn assume paper size: nn Lines/page (default is 66).
_ /Tnn assume Tab stops every nn columns (default is 8).
_ /P echo CountPgs' report to the Printer.
_ /F echo CountPgs' report to File. By default, it goes to
COUNTPGS.LST, but /F:filespec sends it where you like. You
can specify the whole thing; e.g.: /F:C:\TEMP\FILESIZE.LST
_ /V ("Verbose") Show, page by page (counting by formfeeds),
number & width of the lines and size of any left margin.
_ /C ("Compact verbose") List just the lines/page for each page
(counting by FF's), crammed 20/line.
Remarks: CountPgs can handle 25 filenames, which may contain wildcards.
Each must have its own drive and path designations. Thus:
COUNTPGS B:XYZ.TXT
COUNTPGS B:\*.DOC /V/T5
COUNTPGS B:ABCD.TXT C:\XYZ*.DOC C:\FOO\AB??.* /P /L55
Or, enter just COUNTPGS. It'll show you what to do.
Most printers will feed out the rest of the page when they encoun-
ter a "form-feed" character, ASCII #12. (On the screen, it shows
up as either ^L or the Venus (female) sign.) Some files use form-
feed characters to divide pages; some just feed out the proper
number of lines per page. If there are any FF's at all, the num-
ber of FF's should (but may not) be the number of pages. When
there are no form-feeds, CountPgs calculates the number of pages
from the line count.
It counts lines by line-feeds rather than carriage returns, so it
isn't put off by files that use CR's to make underlining, &c. Its
line width allows for CR's, Tabs, and back-space characters, but
it won't keep up with sophisticated print-control characters or
embedded word-processor codes.
________COUNTPGS 3.53 Page 2
On The Pathology of Text Files
(and what CountPgs can do about it)
To find out how much paper to lay out, I once looked at the end of a file
and found page 1105. Refusing to believe it, I wrote CountPgs. That
page turned out to be p. 5 of Chap. 11, of course, and the whole thing
ran about 100 pages. Whew! In its present form, CountPgs gives several
other kinds of information. We've all seen DOC files with bungled pagin-
ation. CountPgs can point you to making repairs before wasting paper.
It can help with at least eight kinds of trouble:
1. It will indicate files with ragged ends --that end in the middle of a
page. This happens when there are lines after the last FF. A file
without FF's has a ragged end if the pages don't come out even. If
____ the file ends in the middle of a line (has characters after the last
FF or LF), CountPgs will call it "cut off." You can COPY PRN a rag-
ged or cut off file, but before you COPY PRN a bunch of them, you'll
have to do something clever.
A file with a ragged end and no FF's may not be paged at all. It may
be meant for the screen; it may be a thoughtless scrawl. On the
other hand, a "ragged end" one line long, is probably just a CR/LF
after the FF (some editors put that in automatically). If the look
of your printout matters, look at the file before you print. To pag-
inate it properly, you may want to overhaul it with Mangler and Pa-
gina or pull it into your word-processor.
2. On the other hand, make sure your word-processor won't make trouble
of its own. CountPgs tells you whether the file uses bare carriage
returns (CR's without LF's) because such a file has to be handled
carefully. Some editors read characters until they find a CR, assume
that's the end of the line and start another line at that point. If
the file was using CR to go back and add underlining, you'll now have
two lines, one with the words and one with the underlines. Try to
fix it in such an editor, and you might get one long line with words
on one end and underlines on the other. If CountPgs tells you a file
has CR's, check your word-processor before you pull it in.
3. FF's may be wrongly placed. Occasionally, a page will have more than
a pageful of lines between FF's. CountPgs will say something like
"4? 5? pages." The smaller is the number of FF's, but the printout
will actually take 5 pages. Most likely, 4 were intended, but some-
body bungled. Before you print out such a file, you may want to fix
it up. CountPgs will indicate which pages are oversize. The /V op-
tion will list the lengths of every page --presuming they're paged
with FF's. If there are no FF's, /V will have nothing to say.
____________ If the /V option shows pages consistently oversized, they may be laid
out for longer pages. If you can set your printer for different line
spacings, try other /L settings to find something suitable. Con-
versely, if CountPgs comes up with something like "1? 5? pages, most
likely there's a stray FF at the end of a file that wasn't supposed
to have any --either paged by counting lines or not paged at all.
Occasionally, an otherwise harmless librarian will leave a lone FF at
the end of his little addendum.
________COUNTPGS 3.53 Page 3
4. Lines may be too long for the printer. When a line is too long, it
folds. You get two lines of print, but the computer counts it as
one, so pages can slop over at the end. Forewarned (by CountPgs),
you can use smaller type to keep the lines straight. Conceivably,
you might manage it with smaller tab widths.
5. Sometimes, a left margin is built into the file. CountPgs will show
________ you the size of the smallest sequence of blanks at the beginning of
the line (except for lines which have no print on them at all). A
check with the /V option can show an occasional odd page which might
be fixed. A regular alternation of margin size, especially an alter-
nation of 0 with something else, may indicate a file meant to be
printed on both sides of the paper. Check the page headers; you may
need a program like Prn2Both to take the file apart.
6. CountPgs will report whether a file contains high-bit characters,
that is characters with ASCII numbers greater than 127. Usually,
these are printer graphics characters. If your printer can produce
them, you should make sure it's set to do so when you print such a
file. It is just possible, however, that the high bit characters
aren't meant as graphics. Many printers will produce italics for
these characters. If you don't want a false start, you'd better look
at the file.
7. Some programs mark the end of a file on disk with an "end of file"
character (^Z, ASCII 26). CP/M worked this way, and the technique
was carried over to DOS. Since DOS keeps a record of the number of
bytes in the file, however, a program can use that number to find the
end of the file instead of looking for a ^Z end marker. If a number-
of-bytes program copies a ^Z-marked file, it will probably copy the
^Z, too. Combine several files that way, and you'll have false ^Z
end-of-file markers in your text. (Some versions of PrnSet used to
make this mistake.) Some programs will load it wrong or bobtail it
at the ^Z. To fix the file, remove all the ^Z's in it with Mangler's
"DelRep" (delete/replace) function.
On the other hand, a ^Z-marked file read by a number-of-bytes program
may falsely appear to have text beyond the ^Z. (LIST will do that
sometimes.) In that case, you want to truncate the file at the ^Z,
that is, convince DOS to change its file length record. DOS will do
this for you with the /A switch on the COPY command:
COPY filename.old /A filename.new
will truncate the file at the first ^Z.
Which to do? You'd better look at the file with LIST or some other
file display. Your word processor may or may not refuse to read past
the first ^Z it comes to.
8. Finally, some files begin with an irritating FF to make a guard
sheet. CountPgs will point this out. If terminal FF's also irritate
you, use the Verbose option and watch for a last page with 1 or 0
lines.
________COUNTPGS 3.53 Page 4
Version History (belated):
3.23 (Aug 1989) total line and character counts.
3.30 (Oct 1989) Longest line count for FF'd files.
3.31 (Dec 1989) fix bug in longest line count w oversize pages.
3.32 ( " " ) report whether file uses tabs.
3.40 ( " " ) report ^Z in text.
3.50 (Feb 1990) report high-bit characters in text. Better stop-
ping on <Esc> or Ctrl-C.
3.51 (Apr 1990) report "cut off" instead of "ragged" when ends in
middle of a line. (CR, BS or EoF apart, any character
after the last LF or FF makes it "cut off.") .51a (8/91)
can count more than 32K lines.
3.52 (Oct 1992) Bug in TP6: reset balks at non-text read-only files.
Works around by using text files or changing attribute temp-
orarily. .52a (11/92): bugfix for files with more than 999
lines. .52b reads read-only files the right way --no need
to fiddle with attributes. .52c (1/93) can print what .51a
could count.
3.53 (Dec 1993) Put the /F report file anywhere you like.
---R. N. Wisan, December, 1993
37 Clinton St, Oneonta, NY 13820
internet: wisanr@hartwick.edu